package com.calvin.study.controller;

import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import com.calvin.study.utils.FileUploadUtil;

@RestController
@RequestMapping(value = "/api/file")
public class FileController {
	
	@PostMapping(value="upload")
	public String uploadFile(MultipartFile file) throws Exception {
		if (file == null) {
			return "请选择要上传的文件";
		}
		
		FileUploadUtil.uploadImage(file);
		return "上传成功";
	}

}
